package android.demo.activity.launchmode.singleinstance;

import android.content.Intent;
import android.demo.BaseActivity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class SingleInstanceActivityB extends BaseActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		LinearLayout layout = new LinearLayout(this);
		layout.setOrientation(LinearLayout.VERTICAL);
		
		TextView tv = new TextView(this);
		tv.setText(this + "@" + this.getTaskId());
		
		Button btn = new Button(this);
		btn.setText("Go ActivityA");
		btn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(SingleInstanceActivityB.this, SingleInstanceActivityA.class);
				startActivity(intent);
				
			}
		});
		
		layout.addView(tv);
		layout.addView(btn);
		this.setContentView(layout);
	}
}
